﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class HomePage_ShowList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public string WriteShow()
    {
        int i = 0;
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = "Show";                                               //要查询的表明
        dbPage.Key = "Id";                                               //表的主键    
        dbPage.Where = "(ShowUrl Is Not Null And ShowUrl <>'')";                                           //查询条件    
        dbPage.SelectField = "Id,ShowName,ShowDate,ShowProject,ShowSort,ShowUrl";//要显示的字段
        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);          //要显示第几页   
        dbPage.PageSize = 24;                                                    //没有显示记录条数   
        dbPage.OrderBy = " Id";                  //排序字段
        dbPage.OrderByIsDesc = true;
        System.Data.IDataReader dr = dbPage.ExecuteReader();

        sb.Append("<ul>");
        while (dr.Read())
        {
            i++;
            sb.Append("<li>");
            sb.Append("<div style='float:left'><img src='../images/gif-0057.gif' >&nbsp;<a href='../HomePage/" + dr["ShowUrl"] + "?pid=" + MsgBox.JiaMiobj_Encrypt(dr["Id"].ToString()) + "' target=_blank>" + dr["ShowName"].ToString() + "</a>");
            if (System.DateTime.Now <= Convert.ToDateTime(dr["ShowDate"].ToString()).AddDays(2))
                sb.Append("&nbsp;<img src='../images/new.gif' width='28' height=11></div>");
            else
                sb.Append("</div>");
            sb.Append("<div class=\"TT\">[" + Convert.ToDateTime(dr["ShowDate"].ToString()).ToString("yy-MM-dd") + "]</div>");
            sb.Append("</li>");
        }
        sb.Append("</ul>");
        dr.Close();
        dr.Dispose();

        db.Close();
        this.DbPageFlip1.DbPage = dbPage;//将数据传给控键


        dbPage.Db.Close();

        return sb.ToString();
    }
}
